namespace Synergy.Extensions
{
	/// <summary>
	/// Extension methods for the <see cref="double"/> class.
	/// </summary>
	/// <remarks>
	///		<list type="table">
	///			<listheader><term>Version</term><description>Description</description></listheader>
	///			<item>
	///				<term>1.0</term>
	///				<description>Initial version</description>
	///			</item>
	///		</list>
	/// </remarks>
	public static class DoubleExtension
	{
		/// <summary>
		/// Determines whether <paramref name="value"/> is between, but not equal to, the specified 
		/// <paramref name="lower"/> and <paramref name="upper"/> bounds.
		/// </summary>
		/// <param name="value">The value to check.</param>
		/// <param name="lower">The lower bound.</param>
		/// <param name="upper">The upper bound.</param>
		/// <returns><c>true</c>, if within lower and upper bounds; otherwise, <c>false</c>.</returns>
		public static bool Between(this double value, double lower, double upper)
		{
			return BetweenExclusive(value, lower, upper);
		}
        
		/// <summary>
		/// Determines whether <paramref name="value"/> is between, but not equal to, the specified 
		/// <paramref name="lower"/> and <paramref name="upper"/> bounds.
		/// </summary>
		/// <param name="value">The value to check.</param>
		/// <param name="lower">The lower bound.</param>
		/// <param name="upper">The upper bound.</param>
		/// <returns><c>true</c>, if within lower and upper bounds; otherwise, <c>false</c>.</returns>
		public static bool BetweenExclusive(this double value, double lower, double upper)
		{
			return (value > lower && value < upper);
		}
        
		/// <summary>
		/// Determines whether <paramref name="value"/> is between or equal to the specified 
		/// <paramref name="lower"/> and <paramref name="upper"/> bounds.
		/// </summary>
		/// <param name="value">The value to check.</param>
		/// <param name="lower">The lower bound.</param>
		/// <param name="upper">The upper bound.</param>
		/// <returns><c>true</c>, if within lower and upper bounds; otherwise, <c>false</c>.</returns>
		public static bool BetweenInclusive(this double value, double lower, double upper)
		{
			return (value >= lower && value <= upper);
		}
	}
}